package com.srs.util;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class HibernateUtil {
	private static SessionFactory sessionFactory;

	public static void createSessionFactory() {
		System.out.println("HibernateUtil::createSessionFactory::start");
		sessionFactory = new Configuration().configure().buildSessionFactory();
		System.out.println("HibernateUtil::createSessionFactory::end");
	}

	public static Session getSession() {
		return sessionFactory.openSession();
	}

	public static void setSessionFactory(SessionFactory sessionFactory) {
		HibernateUtil.sessionFactory = sessionFactory;
	}

}
